<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;

        }

        li {
            list-style: none;
            width: 90px;
            height: 50px;
            /* background-color: pink; */
        }

        a {
            display: block;
            width: 90px;
            height: 50px;
            text-align: center;
            line-height: 50px;
            text-decoration: none;
            color: #000;
            border: 1px solid orange;
        }

        #one {
            position: relative;
        }

        #two {
            position: absolute;
            display: none;
            top: 50px;
            left: 0;
        }

        .nav {
            position: absolute;
            top: 50%;
            left: 50%;

        }
    </style>
</head>

<body>
    <ul class="nav">
        <li id="one">
            <a href="#">微博</a>
            <ul id="two">
                <li><a href="#">私信</a></li>
                <li><a href="#">评论</a></li>
                <li><a href="#">@我</a></li>
            </ul>
        </li>
    </ul>

    <script>
        //获取事件源
        var one = document.querySelector('#one')
        var two = document.querySelector('#two')
        var a = document.querySelectorAll('a')
        one.onmouseover = function () {
            two.style.display = 'block'
            // console.log('触发')
        }
        one.onmouseout = function () {
            two.style.display = 'none'
        }
        for (var i = 0; i < a.length; i++) {
            a[i].onmouseover = function () {
                this.style.backgroundColor = 'orange'
            }
            a[i].onmouseout = function () {
                this.style.backgroundColor = ''
            }
        }
    </script>
</body>

</html>